package com.yykj.user.center.server.repository.patient;

import com.yykj.user.center.server.model.Patient;
import com.yykj.user.center.server.model.RegisteredOrder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

/**
 * @author chenl
 * @version 1.0
 * @date 2021/10/20 22:24
 */
@Repository
public interface RegisterOrderRepository extends JpaRepository<RegisteredOrder, String>, JpaSpecificationExecutor<RegisteredOrder> {


    Integer countAllByPatientCardIdAndDate(String patientCardId, LocalDate localDate);

    Integer countAllByDeptIdAndDate(Integer deptId, LocalDate localDate);

    Integer countAllByPatientCardIdAndDateBetween(String patientCardId, LocalDate localDate1, LocalDate localDate);

    RegisteredOrder findFirstByAccountIdAndOrderNo(String payAccountId,String orderNo);

    RegisteredOrder findFirstByOrderNo(String orderNo);

    List<RegisteredOrder> findAllByStateAndDateBefore(Integer state,LocalDate date);

    Integer countByDateAndDoctorIdAndStateIn(LocalDate date,String doctorId,int[] states);
}
